package ca.concordia.soen6461.wichf.ui.web.parser;

import javax.servlet.http.HttpServletRequest;

import ca.concordia.soen6461.wichf.controller.Session;
import ca.concordia.soen6461.wichf.navigation.event.ManageAppointmentEvent;
import ca.concordia.soen6461.wichf.ui.web.BaseEventParser;

public abstract class ManageAppointmentEventParser<T extends ManageAppointmentEvent> extends BaseEventParser<T> {

	public ManageAppointmentEventParser(Class<T> eventType) {
		super(eventType);
	}

	@Override
	public T parse(HttpServletRequest request, Session session) {
		int day = Integer.parseInt(request.getParameter("day"));
		int time = Integer.parseInt(request.getParameter("time"));
		T event = createEvent(session, day, time);
		return event;
	}

	protected abstract T createEvent(Session session, int day, int time);

}
